#ifndef _ga_selector_h_
#define _ga_selector_h_

#include <string.h>
#include "galite/GAGenome.h"
#include "galite/GAPopulation.h"
#include "galite/garandom.h"

#include <iostream>
using namespace std;

class GASelectionScheme {
  protected:
  GARandom *randObj;
public:
  GASelectionScheme():randObj(0){}
  virtual GAGenome& select()=0;
  virtual void update(const GAPopulation *pop)=0;
  virtual ~GASelectionScheme(){}
  void setRandomObj(GARandom *randO)
	{
		randObj = randO;
	}
};

/* ----------------------------------------------------------------------------
   Roulette wheel uses a fitness-proportional algorithm for selecting 
individuals.
---------------------------------------------------------------------------- */
class GARouletteWheelSelector : public GASelectionScheme {
  protected:
  float *psum;
  const GAPopulation *pop;

  public:
    GARouletteWheelSelector():psum(0), pop(0) {}
    virtual GAGenome& select();
    void update(const GAPopulation *pop);
    virtual ~GARouletteWheelSelector(){}
  };

/* ----------------------------------------------------------------------------
   This version of the tournament selector does two roulette wheel selections
then picks the better of the two.  We derive from the roulette wheel class so
that we can use its update method.
---------------------------------------------------------------------------- */
class GATournamentSelector : public GARouletteWheelSelector {
public:
  GAGenome& select();
  ~GATournamentSelector(){}
};



#endif
